import { useDetail, useList } from "@/hooks";
import { getUserInfoUrl } from "@/command/apiTool";
import { useRoute } from "vue-router";

export const useRequest = () => {
  const route = useRoute();
  const position = localStorage.getItem("positionData") as string;
  const positionJSON = JSON.parse(position) as {
    latitude: string;
    longitude: string;
  };
  // 品牌详情
  const [brandInfo, brandInfoRefrush] = useDetail(
    getUserInfoUrl(
      {
        dh: "",
        xh: "/api/H5/sell/brand/small/getInfoById",
      },
      {
        id: route.query.id,
        lat: positionJSON.latitude,
        lng: positionJSON.longitude,
      }
    ),
    {
      id: "",
      name: "",
      logoUrl: "",
      majorName: "",
      address: "",
      introduce: "",
      phone: "",
      list: [],
    }
  );
  return {
    brandInfo,
    brandInfoRefrush,
  };
};
